#include "linux/types.h"
#include "linux/smp.h"
#include "linux/common.h"
#include "linux/clockchips.h"
#include "linux/clocksource.h"

void OS_Clock_Tick(void *arg);

u64 jiffies_64 = 0;

void do_timer(unsigned long ticks)
{
	jiffies_64 += ticks;
}


static void tick_periodic(int cpu)
{
    do_timer(1);
    //update_process_times();
	OS_Clock_Tick(NULL);
}

void tick_handle_periodic(struct clock_event_device *dev)
{
    int cpu = smp_processor_id();
    
    tick_periodic(cpu);
}

static void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
{
	dev->event_handler = tick_handle_periodic;
}

void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
{
	tick_set_periodic_handler(dev, broadcast);
}

void clockevents_register_device(struct clock_event_device *dev)
{
    tick_setup_periodic(dev, 0);
}

void clockevents_config_and_register(struct clock_event_device *dev)
{
	clockevents_register_device(dev);
}